Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DictionaryProperty valid_types bugs, and other misc property issues #602

Conversation

chisholm
Copy link
Contributor

Fix DictionaryProperty so that EnumProperty and ReferenceProperty both work as valid_types, and fix some bugs.

  • DictionaryProperty.init()'s valid_types argument now accepts either property classes or instances
  • DictionaryProperty now correctly propagates allow_custom down to its valid_types properties, and propagates their returned has_custom flag upward
  • DictionaryProperty's cleaned dictionaries actually contain the cleaned values now (before, the cleaned values were ignored)

Property class cleanup:

  • Property subclass .clean() methods now are correct overrides of the base class method, including parameter naming and default values
  • OpenVocabProperty now doesn't treat any value as custom, regardless of the allow_custom setting, which was our original intent. A violation of strict mode now causes ValueError to be raised, not CustomContentError.
  • BooleanProperty.clean() now honors strict=True (it will only accept values True and False in that case).

Added various property tests of strictness, and additional DictionaryProperty tests which exercise custom value detection when used with ReferenceProperty.

work as valid_types, and fix some bugs.
 - DictionaryProperty.__init__()'s valid_types argument now accepts either
   property classes or instances
 - DictionaryProperty now correctly propagates allow_custom down to its
   valid_types properties, and propagates their returned has_custom flag
   upward
 - DictionaryProperty's cleaned dictionaries actually contain the cleaned
   values now (before, the cleaned values were ignored)

Property class cleanup:
 - Property subclass .clean() methods now are correct overrides of the
   base class method, including parameter naming and default values
 - OpenVocabProperty now doesn't treat any value as custom, regardless of
   the allow_custom setting, which was our original intent.  A violation
   of strict mode now causes ValueError to be raised, not
   CustomContentError.
 - BooleanProperty.clean() now honors strict=True (it will only accept
   values True and False in that case).

Added various property tests of strictness, and additional
DictionaryProperty tests which exercise custom value detection when used
with ReferenceProperty.
@rpiazza rpiazza merged commit 92231d9 into oasis-open:relational-data-sink Sep 16, 2024
1 of 6 checks passed
@chisholm chisholm deleted the relational-data-sink-fix-dictionary-property branch September 16, 2024 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants